import {
  Request
} from "@/until/request.js"

//登录接口
export const login = (obj, data) => Request.getData({
  url: `/api/user/login.do?username=${obj.username}&password=${obj.password}`,
  method: "post",
  data
})
//首页接口 
export const shou = (data) => Request.getData({
  url: `/api/statistic/base_count.do`,
  method: "get",
  data
})

//商品管理列表
export const goodsList = data => Request.getData({
  url: `/api/product/list.do`,
  method: "get",
  data
})


//商品管理列表分页
export const goodsPage = (obj, data) => Request.getData({
  url: `/api/product/list.do?pageNum=${obj}`,
  method: "get",
  data
})



//商品管理列表搜索
export const shopListSearch = data => Request.getData({
  url: "/api/product/search.do",
  method: "get",
  data,
})
// 商品管理搜索后分页
export const shopSearchPagination = data => Request.getData({
  url: "/api/product/search.do",
  method: "get",
  data,
})

//商品管理上架  下架
export const shopSale = data => Request.getData({
  url: "/api/product/set_sale_status.do",
  method: "get",
  data,
})
// 商品管理查看接口
export const GoodList=(page,data)=> Request.getData({
  url:`/api/product/detail.do?productId=${page}`,
  method:"Get",
  data
});

export const Goods=(id,data)=> Request.getData({
  url:`/api/category/get_category.do?categoryId=${id}`,
  method:"Get",
  data
})
// 商品修改
export const coos=(list,data)=> Request.getData({
  url:`/api/product/save.do?categoryId=${list.categoryId}&name=${list.name}&subtitle=${list.subtitle}&subImages=${list.subImages}&detail=${list.detail}&price=${list.price}&stock=${list.stock}&status=${list.status}&id=${list.id}`,
  method:"Get",
  data
})
// 商品添加
export const cook = (obj, data) => Request.getData({
  url: `/api/product/save.do?categoryId=${obj.categoryId}&name=${obj.name}&subtitle=${obj.subtitle}&subImages=${obj.subImages}&detail=${obj.detail}&price=${obj.price}&stock=${obj.stock}&status=${obj.status}&region=${obj.region}`,
  method: "Get",
  data
})

export const add = (id, data) => Request.getData({
  url: `/api/category/get_category.do?categoryId=${id}`,
  method: "Get",
  data
})
// 上传图片
export const image = (data) => Request.getData({
  url: `/api/product/upload.do`,
  method: "Post",
  data
})
//品类管理列表..
export const lei = (data) => Request.getData({
  url: `/api/category/get_category.do?categoryId=0`,
  method: "get",
  data
})
// 品类管理查看
export const chalei = (obj, data) => Request.getData({
  url: `/api/category/get_category.do?categoryId=${obj}`,
  method: "get",
  data
})
// 修改名称
export const name = (obj, data) => Request.getData({
  url: `/api/category/set_category_name.do?categoryId=${obj.id}&categoryName=${obj.name}`,
  method: "get",
  data
})
//品类添加
export const fakeradd= (obj,data)=>Request.getData({
  url:`/api/category/get_category.do?categoryId=${obj}`,
  method:"Get",
  data
})
export const fakerok= (obj,data)=>Request.getData({
  url:`/api/category/add_category.do?parentId=${obj.id}&categoryName=${obj.name}`,
  method:"Get",
  data
})



// 订单列表
export const orderList = data => Request.getData({
  url: `/api/order/list.do`,
  method: "get",
  data
})
// 订单分页
export const orderPage = (obj, data) => Request.getData({
  url: `/api/order/list.do?pageNum=${obj}`,
  method: "get",
  data
})

// 查看订单
export const detail = (obj, data) => Request.getData({
  url: `/api/order/detail.do?orderNo=${obj}`,
  method: "get",
  data
})
// 查询接口
export const search = (obj, data) => Request.getData({
  url: `/api/order/search.do?listType=search&pageNum=${obj.pageNum}&orderNo=${obj.orderNo}`,
  method: "get",
  data
})
// 用户列表
export const userList = data => Request.getData({
  url: `/api/user/list.do`,
  method: "post",
  data
})



// 用户列表   分页器

export const userPagination = (obj, data) => Request.getData({
  url: `/api/user/list.do?pageNum=${obj}`,
  method: "get",
  data
})
